package com.pengshun.modules.api.statistical.controller;

import com.pengshun.modules.api.coal.para.CoalParam;
import com.pengshun.modules.api.coal.validator.First;
import com.pengshun.modules.api.coal.validator.Fourth;
import com.pengshun.modules.api.statistical.service.CoalStatisticalService;
import com.pengshun.modules.common.BaseResult;
import com.pengshun.modules.common.PagePara;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author luoligang
 * @create 2021/1/25
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "煤炭价格统计管理")
@ApiIgnore
@RequestMapping("/api/coal/statistical")
public class CoalStatisticalController {

    private final CoalStatisticalService coalStatisticalService;

    @ApiOperation(value = "指数列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页从0开始 ", dataType = "int", required = true, paramType = "query"),
            @ApiImplicitParam(name = "size", value = "请求条数 ", dataType = "int", required = true, paramType = "query"),
    })
    @GetMapping(value = "/list")
    public BaseResult getCoalStatisticalList(@ApiIgnore @Validated(value = {First.class}) PagePara dto) throws Exception {
        BaseResult res = coalStatisticalService.getCoalStatisticalList(dto);
        return res;

    }
    @ApiOperation(value = "指数详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "coalId", value = "煤炭id ", dataType = "int", required = true, paramType = "query"),
            @ApiImplicitParam(name = "type", value = "1近7天 2近三月，3近半年，4近一年 5 全部 6 年同比", dataType = "int", required = true, paramType = "query"),
    })
    @GetMapping(value = "/detil")
    public BaseResult detil(@ApiIgnore @Validated(value = {First.class}) CoalParam dto) throws Exception {
        BaseResult res = coalStatisticalService.detil(dto);
        return res;

    }
    @ApiOperation(value = "煤炭最新调价")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页从0开始 ", dataType = "int", required = true, paramType = "query"),
            @ApiImplicitParam(name = "size", value = "请求条数 ", dataType = "int", required = true, paramType = "query"),
    })
    @GetMapping(value = "/coal-price")
    public BaseResult getCoalNewPriceList(@ApiIgnore @Validated(value = {First.class}) PagePara dto) throws Exception {
        BaseResult res = coalStatisticalService.getCoalNewPriceList(dto);
        return res;

    }
}
